A typical computing device employs a wide variety of executable program code to perform various tasks. For example, program code can be included as part of an operating system, an application, a utility, and/or other functionality that can be executed via a computing device. Such program code typically includes functions that can be called to perform various tasks. For example, a particular function can be called by an application to calculate a value based on parameters that are passed to the function.
Included with such functions are virtual functions. A virtual function refers generally to a function in object-oriented programming that is a member function of a base class and whose functionality can be overridden in a derived class of the base class. Virtual functions can be called on derived classes to enable different tasks and/or functionalities to be performed than are provided by a base class of the derived classes.
In certain scenarios, it can be useful to intercept a call to a virtual function and redirect the call to a replacement function. For example, a software testing utility can intercept a call to a virtual function by an application. The utility can then redirect the call to a replacement function in order to test various operating scenarios that may arise when the application is executed. Current techniques for replacing a virtual function with a replacement function are time and resource intensive, and are prone to errors that can be introduced due to changes in class layout and/or compiler settings.